package cqrtplm.controller;

import com.alibaba.fastjson.JSONObject;
import com.ty.basic.response.ResponseResult;
import cqrtplm.constant.RouteConstant;
import cqrtplm.service.HistoryDataImportService;
import cqrtplm.service.RTOaIntegrityService;
import cqrtplm.service.TestMappingService;
import cqrtplm.service.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.LinkedHashMap;


/**
 * The type Test controller.
 */
@RestController
@Api(tags = "xxx服务")
@RequestMapping(RouteConstant.PATH + "getDocument")
public class TestController {

    @Resource
    private TestMappingService testMappingService;
    @Resource
    private RTOaIntegrityService rtOaIntegrityService;
    @Resource
    private TestService testService;
    @Resource
    private HistoryDataImportService historyDataImportService;
    /**
     *
     */
    @GetMapping("/one")
    @ApiOperation(value = "one", produces = "application/json; charset=utf-8")
    public ResponseResult one() {
        return ResponseResult.success();
    }

    @PostMapping("/test")
    @ApiOperation(value = "test", notes = "方法测试", produces = "application/json; charset=utf-8")
    public ResponseResult test(@RequestBody LinkedHashMap map) throws Exception {
        JSONObject result = testService.testFunc(map);
        return ResponseResult.success(result);
    }


    @GetMapping("/two")
    @ApiOperation(value = "one", produces = "application/json; charset=utf-8")
    public ResponseResult two() {
        rtOaIntegrityService.synOrganizationalStructure();
        return ResponseResult.success();
    }
}
